.class public Lrexsee/keyboard/TouchBallWidget;
.super Landroid/view/View;
.source "TouchBallWidget.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lrexsee/keyboard/TouchBallWidget$OnTouchBallMoveListener;
    }
.end annotation


# instance fields
.field private alpha:I

.field private final mBackground:Landroid/graphics/drawable/Drawable;

.field private final mBall:Landroid/graphics/drawable/Drawable;

.field private final mDialog:Lrexsee/keyboard/TouchBallDialog;

.field private final mOnTouchBallMoveListener:Lrexsee/keyboard/TouchBallWidget$OnTouchBallMoveListener;

.field private mX:I

.field private mY:I

.field private moving:Z

.field private x:Ljava/lang/Integer;

.field private y:Ljava/lang/Integer;


# direct methods
.method public constructor <init>(Landroid/content/Context;Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;Lrexsee/keyboard/TouchBallDialog;Lrexsee/keyboard/TouchBallWidget$OnTouchBallMoveListener;)V
    .locals 2
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "ball"    # Landroid/graphics/drawable/Drawable;
    .param p3, "background"    # Landroid/graphics/drawable/Drawable;
    .param p4, "dialog"    # Lrexsee/keyboard/TouchBallDialog;
    .param p5, "onTouchBallMoveListener"    # Lrexsee/keyboard/TouchBallWidget$OnTouchBallMoveListener;

    .prologue
    const/4 v1, 0x0

    const/4 v0, 0x0

    .line 28
    invoke-direct {p0, p1}, Landroid/view/View;-><init>(Landroid/content/Context;)V

    .line 19
    iput-object v1, p0, Lrexsee/keyboard/TouchBallWidget;->x:Ljava/lang/Integer;

    .line 20
    iput-object v1, p0, Lrexsee/keyboard/TouchBallWidget;->y:Ljava/lang/Integer;

    .line 21
    iput v0, p0, Lrexsee/keyboard/TouchBallWidget;->mX:I

    .line 22
    iput v0, p0, Lrexsee/keyboard/TouchBallWidget;->mY:I

    .line 23
    iput-boolean v0, p0, Lrexsee/keyboard/TouchBallWidget;->moving:Z

    .line 25
    const/4 v0, 0x1

    iput v0, p0, Lrexsee/keyboard/TouchBallWidget;->alpha:I

    .line 29
    iput-object p2, p0, Lrexsee/keyboard/TouchBallWidget;->mBall:Landroid/graphics/drawable/Drawable;

    .line 30
    iput-object p3, p0, Lrexsee/keyboard/TouchBallWidget;->mBackground:Landroid/graphics/drawable/Drawable;

    .line 31
    iput-object p4, p0, Lrexsee/keyboard/TouchBallWidget;->mDialog:Lrexsee/keyboard/TouchBallDialog;

    .line 32
    iput-object p5, p0, Lrexsee/keyboard/TouchBallWidget;->mOnTouchBallMoveListener:Lrexsee/keyboard/TouchBallWidget$OnTouchBallMoveListener;

    .line 33
    iget-object v0, p4, Lrexsee/keyboard/TouchBallDialog;->styleSheet:Lrexsee/core/style/StyleSheet;

    invoke-virtual {v0}, Lrexsee/core/style/StyleSheet;->getIconAlpha()I

    move-result v0

    iput v0, p0, Lrexsee/keyboard/TouchBallWidget;->alpha:I

    .line 34
    new-instance v0, Lrexsee/keyboard/TouchBallWidget$1;

    invoke-direct {v0, p0}, Lrexsee/keyboard/TouchBallWidget$1;-><init>(Lrexsee/keyboard/TouchBallWidget;)V

    invoke-virtual {p0, v0}, Lrexsee/keyboard/TouchBallWidget;->setOnTouchListener(Landroid/view/View$OnTouchListener;)V

    .line 77
    return-void
.end method

.method static synthetic access$0(Lrexsee/keyboard/TouchBallWidget;I)V
    .locals 0

    .prologue
    .line 21
    iput p1, p0, Lrexsee/keyboard/TouchBallWidget;->mX:I

    return-void
.end method

.method static synthetic access$1(Lrexsee/keyboard/TouchBallWidget;I)V
    .locals 0

    .prologue
    .line 22
    iput p1, p0, Lrexsee/keyboard/TouchBallWidget;->mY:I

    return-void
.end method

.method static synthetic access$10(Lrexsee/keyboard/TouchBallWidget;)Lrexsee/keyboard/TouchBallWidget$OnTouchBallMoveListener;
    .locals 1

    .prologue
    .line 17
    iget-object v0, p0, Lrexsee/keyboard/TouchBallWidget;->mOnTouchBallMoveListener:Lrexsee/keyboard/TouchBallWidget$OnTouchBallMoveListener;

    return-object v0
.end method

.method static synthetic access$11(Lrexsee/keyboard/TouchBallWidget;)Z
    .locals 1

    .prologue
    .line 23
    iget-boolean v0, p0, Lrexsee/keyboard/TouchBallWidget;->moving:Z

    return v0
.end method

.method static synthetic access$12(Lrexsee/keyboard/TouchBallWidget;)V
    .locals 0

    .prologue
    .line 109
    invoke-direct {p0}, Lrexsee/keyboard/TouchBallWidget;->moveDialog()V

    return-void
.end method

.method static synthetic access$13(Lrexsee/keyboard/TouchBallWidget;)Lrexsee/keyboard/TouchBallDialog;
    .locals 1

    .prologue
    .line 16
    iget-object v0, p0, Lrexsee/keyboard/TouchBallWidget;->mDialog:Lrexsee/keyboard/TouchBallDialog;

    return-object v0
.end method

.method static synthetic access$2(Lrexsee/keyboard/TouchBallWidget;I)V
    .locals 0

    .prologue
    .line 25
    iput p1, p0, Lrexsee/keyboard/TouchBallWidget;->alpha:I

    return-void
.end method

.method static synthetic access$3(Lrexsee/keyboard/TouchBallWidget;Z)V
    .locals 0

    .prologue
    .line 23
    iput-boolean p1, p0, Lrexsee/keyboard/TouchBallWidget;->moving:Z

    return-void
.end method

.method static synthetic access$4(Lrexsee/keyboard/TouchBallWidget;)Ljava/lang/Integer;
    .locals 1

    .prologue
    .line 19
    iget-object v0, p0, Lrexsee/keyboard/TouchBallWidget;->x:Ljava/lang/Integer;

    return-object v0
.end method

.method static synthetic access$5(Lrexsee/keyboard/TouchBallWidget;)I
    .locals 1

    .prologue
    .line 21
    iget v0, p0, Lrexsee/keyboard/TouchBallWidget;->mX:I

    return v0
.end method

.method static synthetic access$6(Lrexsee/keyboard/TouchBallWidget;Ljava/lang/Integer;)V
    .locals 0

    .prologue
    .line 19
    iput-object p1, p0, Lrexsee/keyboard/TouchBallWidget;->x:Ljava/lang/Integer;

    return-void
.end method

.method static synthetic access$7(Lrexsee/keyboard/TouchBallWidget;)Ljava/lang/Integer;
    .locals 1

    .prologue
    .line 20
    iget-object v0, p0, Lrexsee/keyboard/TouchBallWidget;->y:Ljava/lang/Integer;

    return-object v0
.end method

.method static synthetic access$8(Lrexsee/keyboard/TouchBallWidget;)I
    .locals 1

    .prologue
    .line 22
    iget v0, p0, Lrexsee/keyboard/TouchBallWidget;->mY:I

    return v0
.end method

.method static synthetic access$9(Lrexsee/keyboard/TouchBallWidget;Ljava/lang/Integer;)V
    .locals 0

    .prologue
    .line 20
    iput-object p1, p0, Lrexsee/keyboard/TouchBallWidget;->y:Ljava/lang/Integer;

    return-void
.end method

.method private moveDialog()V
    .locals 8

    .prologue
    .line 110
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->mDialog:Lrexsee/keyboard/TouchBallDialog;

    if-nez v6, :cond_1

    .line 125
    :cond_0
    :goto_0
    return-void

    .line 111
    :cond_1
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->mDialog:Lrexsee/keyboard/TouchBallDialog;

    iget-object v6, v6, Lrexsee/keyboard/TouchBallDialog;->styleSheet:Lrexsee/core/style/StyleSheet;

    iget-object v6, v6, Lrexsee/core/style/StyleSheet;->window_moveable:Ljava/lang/String;

    const-string v7, "true"

    invoke-virtual {v6, v7}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v6

    if-eqz v6, :cond_0

    .line 112
    invoke-virtual {p0}, Lrexsee/keyboard/TouchBallWidget;->getWidth()I

    move-result v4

    .line 113
    .local v4, "width":I
    invoke-virtual {p0}, Lrexsee/keyboard/TouchBallWidget;->getHeight()I

    move-result v1

    .line 114
    .local v1, "height":I
    const/4 v2, 0x0

    .local v2, "offsetX":I
    const/4 v3, 0x0

    .line 115
    .local v3, "offsetY":I
    iget v6, p0, Lrexsee/keyboard/TouchBallWidget;->mX:I

    if-gez v6, :cond_5

    iget v2, p0, Lrexsee/keyboard/TouchBallWidget;->mX:I

    .line 117
    :cond_2
    :goto_1
    iget v6, p0, Lrexsee/keyboard/TouchBallWidget;->mY:I

    if-gez v6, :cond_6

    iget v3, p0, Lrexsee/keyboard/TouchBallWidget;->mY:I

    .line 119
    :cond_3
    :goto_2
    if-nez v2, :cond_4

    if-eqz v3, :cond_0

    .line 120
    :cond_4
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->mDialog:Lrexsee/keyboard/TouchBallDialog;

    invoke-virtual {v6}, Lrexsee/keyboard/TouchBallDialog;->getWindow()Landroid/view/Window;

    move-result-object v5

    .line 121
    .local v5, "window":Landroid/view/Window;
    invoke-virtual {v5}, Landroid/view/Window;->getAttributes()Landroid/view/WindowManager$LayoutParams;

    move-result-object v0

    .line 122
    .local v0, "attr":Landroid/view/WindowManager$LayoutParams;
    iget v6, v0, Landroid/view/WindowManager$LayoutParams;->x:I

    add-int/2addr v6, v2

    iput v6, v0, Landroid/view/WindowManager$LayoutParams;->x:I

    .line 123
    iget v6, v0, Landroid/view/WindowManager$LayoutParams;->y:I

    add-int/2addr v6, v3

    iput v6, v0, Landroid/view/WindowManager$LayoutParams;->y:I

    .line 124
    invoke-virtual {v5, v0}, Landroid/view/Window;->setAttributes(Landroid/view/WindowManager$LayoutParams;)V

    goto :goto_0

    .line 116
    .end local v0    # "attr":Landroid/view/WindowManager$LayoutParams;
    .end local v5    # "window":Landroid/view/Window;
    :cond_5
    iget v6, p0, Lrexsee/keyboard/TouchBallWidget;->mX:I

    if-le v6, v4, :cond_2

    iget v6, p0, Lrexsee/keyboard/TouchBallWidget;->mX:I

    sub-int v2, v6, v4

    goto :goto_1

    .line 118
    :cond_6
    iget v6, p0, Lrexsee/keyboard/TouchBallWidget;->mY:I

    if-le v6, v1, :cond_3

    iget v6, p0, Lrexsee/keyboard/TouchBallWidget;->mY:I

    sub-int v3, v6, v1

    goto :goto_2
.end method


# virtual methods
.method protected onDraw(Landroid/graphics/Canvas;)V
    .locals 9
    .param p1, "canvas"    # Landroid/graphics/Canvas;

    .prologue
    const/4 v8, 0x0

    .line 81
    invoke-virtual {p0}, Lrexsee/keyboard/TouchBallWidget;->getWidth()I

    move-result v5

    .line 82
    .local v5, "width":I
    invoke-virtual {p0}, Lrexsee/keyboard/TouchBallWidget;->getHeight()I

    move-result v2

    .line 83
    .local v2, "height":I
    div-int/lit8 v6, v5, 0x3

    int-to-float v6, v6

    invoke-static {v6}, Ljava/lang/Math;->round(F)I

    move-result v1

    .line 84
    .local v1, "ballWidth":I
    div-int/lit8 v6, v2, 0x3

    int-to-float v6, v6

    invoke-static {v6}, Ljava/lang/Math;->round(F)I

    move-result v0

    .line 85
    .local v0, "ballHeight":I
    new-instance v3, Landroid/graphics/Rect;

    invoke-direct {v3}, Landroid/graphics/Rect;-><init>()V

    .line 86
    .local v3, "rectBackground":Landroid/graphics/Rect;
    iput v1, v3, Landroid/graphics/Rect;->left:I

    .line 87
    iput v0, v3, Landroid/graphics/Rect;->top:I

    .line 88
    mul-int/lit8 v6, v1, 0x2

    iput v6, v3, Landroid/graphics/Rect;->right:I

    .line 89
    mul-int/lit8 v6, v0, 0x2

    iput v6, v3, Landroid/graphics/Rect;->bottom:I

    .line 90
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->mBackground:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v6, v3}, Landroid/graphics/drawable/Drawable;->setBounds(Landroid/graphics/Rect;)V

    .line 91
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->mBackground:Landroid/graphics/drawable/Drawable;

    iget v7, p0, Lrexsee/keyboard/TouchBallWidget;->alpha:I

    invoke-virtual {v6, v7}, Landroid/graphics/drawable/Drawable;->setAlpha(I)V

    .line 92
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->mBackground:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v6, p1}, Landroid/graphics/drawable/Drawable;->draw(Landroid/graphics/Canvas;)V

    .line 93
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->x:Ljava/lang/Integer;

    if-nez v6, :cond_0

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v6

    iput-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->x:Ljava/lang/Integer;

    .line 94
    :cond_0
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->x:Ljava/lang/Integer;

    invoke-virtual {v6}, Ljava/lang/Integer;->intValue()I

    move-result v6

    if-gez v6, :cond_1

    invoke-static {v8}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v6

    iput-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->x:Ljava/lang/Integer;

    .line 95
    :cond_1
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->x:Ljava/lang/Integer;

    invoke-virtual {v6}, Ljava/lang/Integer;->intValue()I

    move-result v6

    mul-int/lit8 v7, v1, 0x2

    if-le v6, v7, :cond_2

    mul-int/lit8 v6, v1, 0x2

    invoke-static {v6}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v6

    iput-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->x:Ljava/lang/Integer;

    .line 96
    :cond_2
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->y:Ljava/lang/Integer;

    if-nez v6, :cond_3

    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v6

    iput-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->y:Ljava/lang/Integer;

    .line 97
    :cond_3
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->y:Ljava/lang/Integer;

    invoke-virtual {v6}, Ljava/lang/Integer;->intValue()I

    move-result v6

    if-gez v6, :cond_4

    invoke-static {v8}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v6

    iput-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->y:Ljava/lang/Integer;

    .line 98
    :cond_4
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->y:Ljava/lang/Integer;

    invoke-virtual {v6}, Ljava/lang/Integer;->intValue()I

    move-result v6

    mul-int/lit8 v7, v0, 0x2

    if-le v6, v7, :cond_5

    mul-int/lit8 v6, v0, 0x2

    invoke-static {v6}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v6

    iput-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->y:Ljava/lang/Integer;

    .line 99
    :cond_5
    new-instance v4, Landroid/graphics/Rect;

    invoke-direct {v4}, Landroid/graphics/Rect;-><init>()V

    .line 100
    .local v4, "rectBall":Landroid/graphics/Rect;
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->x:Ljava/lang/Integer;

    invoke-virtual {v6}, Ljava/lang/Integer;->intValue()I

    move-result v6

    iput v6, v4, Landroid/graphics/Rect;->left:I

    .line 101
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->y:Ljava/lang/Integer;

    invoke-virtual {v6}, Ljava/lang/Integer;->intValue()I

    move-result v6

    iput v6, v4, Landroid/graphics/Rect;->top:I

    .line 102
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->x:Ljava/lang/Integer;

    invoke-virtual {v6}, Ljava/lang/Integer;->intValue()I

    move-result v6

    add-int/2addr v6, v1

    iput v6, v4, Landroid/graphics/Rect;->right:I

    .line 103
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->y:Ljava/lang/Integer;

    invoke-virtual {v6}, Ljava/lang/Integer;->intValue()I

    move-result v6

    add-int/2addr v6, v0

    iput v6, v4, Landroid/graphics/Rect;->bottom:I

    .line 104
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->mBall:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v6, v4}, Landroid/graphics/drawable/Drawable;->setBounds(Landroid/graphics/Rect;)V

    .line 105
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->mBall:Landroid/graphics/drawable/Drawable;

    iget v7, p0, Lrexsee/keyboard/TouchBallWidget;->alpha:I

    invoke-virtual {v6, v7}, Landroid/graphics/drawable/Drawable;->setAlpha(I)V

    .line 106
    iget-object v6, p0, Lrexsee/keyboard/TouchBallWidget;->mBall:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v6, p1}, Landroid/graphics/drawable/Drawable;->draw(Landroid/graphics/Canvas;)V

    .line 107
    return-void
.end method
